package com.chaosj.webmagic.md.api;

import com.chaosj.webmagic.md.StorageApi;
import com.chaosj.webmagic.md.StorageFacade;
import com.chaosj.webmagic.md.entity.ScrapeArticle;
import lombok.extern.slf4j.Slf4j;

/**
 * @className: DefaultStorageModule
 * @description:
 * @author: caoyangjie
 * @date: 2021/12/30
 **/
@Slf4j
public class DefaultStorageModule implements IStorageModule{

    @Override
    public boolean save(ScrapeArticle scrapeArticle) {
        // 保存 文章内容
        StorageApi.storageContent(StorageFacade.storagePath(scrapeArticle.getTopic()), scrapeArticle.getTitle(), scrapeArticle.getContent());
        StorageApi.storageScrapeTarget(scrapeArticle);
        return true;
    }
}
